<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.joinhawaii.home.*" %>
<%
	String ip_addr			= request.getRemoteAddr();

	String job_type			= StringUtil.nvl(request.getParameter("job_type"),"U");
	String board_id			= StringUtil.nvl(request.getParameter("board_id"));
	String word_id			= StringUtil.nvl(request.getParameter("word_id"));
	String search_col		= StringUtil.nvl(request.getParameter("search_col"), "subject");
	String search_word		= StringUtil.toHan(StringUtil.nvl(request.getParameter("search_word")));
	String curr_page 		= StringUtil.nvl(request.getParameter("s_curr_page"), "1");

	HashMap infos = new HashMap();
	infos.put("word_id",		word_id);


	BoardDAO boardDAO 		= new BoardDAO();
	HashList wordList		= boardDAO.selectWordDetail(infos);

	if (!ip_addr.equals(wordList.get("ip_addr",0)) && "U".equals(job_type)) {
		infos.put("job_type", "UC");
		boardDAO.saveWord(infos);
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>조인하와이</title>
	<%@ include file="/admin/include/cssnjs.jsp"  %>
	<script type="text/javascript" src="/SE2.3.1.O9858/js/HuskyEZCreator.js" charset="utf-8"></script>
	<script>
	var oEditors = [];

	$(document).ready(function() {

		cfInitSE("content");

	});


	function fnSave() {
		oEditors.getById["content"].exec("UPDATE_CONTENTS_FIELD", []);
		$('#saveForm').attr('action', './wordSave.do');
		$('#saveForm').submit();
	}

	function fnDelete() {
		if (confirm(MSG_D)) {
			$('#job_type').val('D');
			$('#saveForm').attr('action', './wordSave.do');
			$('#saveForm').submit();
		}
	}

	</script>
</head>
<body>
<div id="wrap">
	<div id="top">
		<%@ include file="/admin/include/top.jsp" %>
	</div>
	<div id="page">
		<div id="menu">
			<%@ include file="/admin/include/leftMenu.jsp" %>
		</div>
		<div id="contents">
			<div class="menu_title">
				<h1>업무게시판</h1>
				<p>관리자 > 견적관리 > <b>업무게시판</b></p>
			</div>
			<div class="clear line_01"></div>

			<div id="tabs-1" class="mt15">

				<form id="saveForm" method="post" action="">
				<input type="hidden" name="job_type" id="job_type" value="<%= job_type %>"/>
	            <input type="hidden" name="board_id" value="<%= board_id %>"/>
	            <input type="hidden" name="word_id" value="<%= word_id %>"/>

		    	<input type="hidden" name="word_num" value="<%= wordList.get("word_num",0) %>">
		    	<input type="hidden" name="sort" value="<%= wordList.get("sort",0) %>">
		    	<input type="hidden" name="depth" value="<%= wordList.get("depth",0) %>">

				<table cellpadding="0" cellspacing="0" class="table_01 mt5">
				<colgroup>
					<col width="100px"/>
					<col width="280px"/>
					<col width="100px"/>
					<col/>
				</colgroup>
				<tbody>
					<tr>
						<th><p>제목</p></th>
						<td colspan="3" class="brx">
							<input type="text" name="subject" id="subject" value="<%= "R".equals(job_type)? "RE:" : "" %><%=wordList.get("subject",0) %>" class="wmax" style="border:0"/>
						</td>
					</tr>
					<tr>
						<th><p>작성일</p></th>
						<td>
							<%= StringUtil.nvl(wordList.get("init_date",0), StringUtil.toDate(TODAY,".")) %>
						</td>
						<th><p>글쓴이</p></th>
						<td class="brx">
							<input type="hidden" name="author_name" style="width:200px;" class="input2" value="<%= StringUtil.nvl(wordList.get("author_name",0), session_user_name) %>"/>
		        			<%= StringUtil.nvl(wordList.get("author_name",0), session_user_name) %>
						</td>
					</tr>
					<tr>
						<th><p>조회수</p></th>
						<td>
							<%= wordList.get("count",0) %>
						</td>
						<th><p></p></th>
						<td class="brx">

						</td>
					</tr>
					<tr>
						<th><p>내용</p></th>
						<td colspan="3" class="brx">
							<textarea name="content" id="content" style="width:860px; height:400px"><%= wordList.get("content", 0) %></textarea>
						</td>
					</tr>
				</tbody>
				</table>

				<div class="mt20 mb10 c">
					<a href="./boardList.jsp?board_id=<%=board_id%>"><img src="/images/admin/btn_list.gif"/></a>
			<%	if ("U".equals(job_type)) { %>
					<a href="./boardView.jsp?job_type=R&board_id=<%=board_id%>&word_id=<%=word_id%>"><img src="/images/admin/btn_reply.gif" /></a>
					<a href="#nohref" onclick="fnSave()"><img src="/images/admin/btn_update.gif" /></a>
					<a href="#nohref" onclick="fnDelete()"><img src="/images/admin/btn_delete.gif" /></a>
			<%	} else if ("C".equals(job_type) || "R".equals(job_type)) { %>
					<a href="#nohref" onclick="fnSave()"><img src="/images/admin/btn_register.gif" /></a>
			<%	} %>
				</div>

				</form>

			</div>


		</div>
	</div>
</div>
</body>
</html>
